<form class="form-horizontal" id="form-add-article">


    <div class="form-group">
        <label class="control-label col-xs-2">绑定会员</label>
        <div class="col-xs-9">
            <!--{include file="public/userSerarch" user-num-name="uid" /}-->
            <input type="text" class="form-control" name="" readonly value="{$info.uid|get_user_mobile}【ID：{$info.uid}】">
            <input type="hidden" name="uid" value="{$info.uid}">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">
            联盟商分类
            <span style="color: #FF0000;">*</span>
        </label>
        <div class="col-xs-9">
            <select id="category-selector" name="type" class="form-control" tabindex="-1" required>
                <option value="">
                    无选择
                </option>
                {volist name="category_list" id="item" }
                <option {if condition="$info.category_id == $item.id"}selected{/if} value="{$item.id}">{$item.title}</option>
                {/volist}
            </select>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">
            联盟商名称
            <span style="color: #FF0000;">*</span>
        </label>
        <div class="col-xs-9">
            <input type="text" class="form-control" name="title"
                   placeholder="请输入联盟商名称" value="{$info.title}" required>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">
            现金扣费比例
            <span style="color: #FF0000;">*</span>
        </label>
        <div class="col-xs-9">
            <input type="number" class="form-control" value="{$info.cut_percent}" name="cut_percent"
                   placeholder="请输入现金扣费比例,百分比，如1则为1%" required>
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">
            LOGO
        </label>
        <div class="col-xs-9">
            {include file="public/singleImageUploader" uploader-name="thumb" /}
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">
            背景图片
            <span style="color: #FF0000;">*</span>
        </label>
        <div class="col-xs-9">
            {include file="public/singleImageUploader2" uploader-name2="background" /}
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">地区</label>
        <div class="col-xs-9">
            {include file="public/areaSelector" province-name="pro" city-name="city" /}
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">
            联系电话
        </label>
        <div class="col-xs-9">
            <input type="text" class="form-control" name="tel" value="{$info.tel}"
                   placeholder="请输入联系电话">
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">
            详细地址
        </label>
        <div class="col-xs-9">
            {include file="public/mapSelector" address-name="address" longitude-name="longitude" latitude-name="latitude" /}
        </div>
    </div>

    <div class="form-group">
        <label class="control-label col-xs-2">
            排序
        </label>
        <div class="col-xs-9">
            <input type="number" class="form-control" name="order" value="{$info.display_order}"
                   placeholder="数字越大 排序越靠前">
        </div>
    </div>


    <div class="form-group">
        <label class="control-label col-xs-2">
            是否显示
        </label>
        <div class="col-xs-9">
            <div class="btn-group" data-toggle="buttons">
                <label class="btn btn-default {if condition='$info.is_visible == 1'}active{/if}">
                    <input type="radio" name="visible" id="visible_1" value="1" {if condition='$info.is_visible == 1'}checked{/if}>
                    显示
                </label>
                <label class="btn btn-default {if condition='$info.is_visible == 0'}active{/if}">
                    <input type="radio" name="visible" id="visible_0" value="0" {if condition='$info.is_visible == 0'}checked{/if}>
                    隐藏
                </label>
            </div>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-2">
            首页推荐
        </label>
        <div class="col-xs-9">
            <div class="btn-group" data-toggle="buttons">
                <label class="btn btn-default {if condition='$info.is_recommend == 1'}active{/if}">
                    <input type="radio" name="recommend" id="recommend_1" value="1" {if condition='$info.is_recommend == 1'}checked{/if}>
                    推荐
                </label>
                <label class="btn btn-default {if condition='$info.is_recommend == 0'}active{/if}">
                    <input type="radio" name="recommend" id="recommend_0" value="0" {if condition='$info.is_recommend == 0'}checked{/if}>
                    不推荐
                </label>
            </div>
        </div>
    </div>
    <!--<div class="form-group">-->
        <!--<label class="control-label col-xs-2">-->
            <!--加入黑名单-->
        <!--</label>-->
        <!--<div class="col-xs-9">-->
            <!--<div class="btn-group" data-toggle="buttons">-->
                <!--<label class="btn btn-default {if condition='$info.in_blacklist == 1'}active{/if}">-->
                    <!--<input type="radio" name="in_blacklist" id="in_blacklist_1" value="1" {if condition='$info.in_blacklist == 1'}checked{/if}>-->
                    <!--已拉黑-->
                <!--</label>-->
                <!--<label class="btn btn-default {if condition='$info.in_blacklist == 0'}active{/if}">-->
                    <!--<input type="radio" name="in_blacklist" id="in_blacklist_0" value="0" {if condition='$info.in_blacklist == 0'}checked{/if}>-->
                    <!--未拉黑-->
                <!--</label>-->
            <!--</div>-->
        <!--</div>-->
    <!--</div>-->
    <div class="form-group">
        <label class="control-label col-xs-2">
            联盟商详情
        </label>
        <div class="col-xs-9">
            {include file="public/ueditor" editor-name="article_detail" /}
        </div>
    </div>

    <div class="form-group">
        <div class="col-xs-offset-2 col-xs-3">
            <input type="hidden" name="id" value="{$info.id}">
            <button type="submit" class="btn btn-success btn-block">
                确认编辑
            </button>
        </div>
    </div>
</form>

<script src="__PUBLIC__/vendors/jquery.validation/jquery.validate.min.js"></script>
<script src="__PUBLIC__/vendors/jquery.validation/additional-methods.js"></script>
<script src="__PUBLIC__/vendors/jquery.validation/messages_zh.min.js"></script>
<script src="__PUBLIC__/vendors/select2/js/select2.min.js"></script>
<script type="application/javascript">
    $(function () {
        $("#form-add-article").validate({
            messages:
                {
                    type: "请选择联盟商分类",
                    title: "请输入联盟商名称",
                    address: "请输入详细地址",
                    cut_percent: "请输入现金扣费比例",
                },
            debug: true,
            submitHandler: function () {
                ajaxSubmit('form-add-article', true);
            }
        });

        //获取分类
        $("#category-selector").select2({
            placeholder: "选择联盟商分类",
            allowClear: true,
            width:'100%'
        });
    })
</script>